﻿<ng-include src="'./includes/header.html'"></ng-include>

<div class="main">
    <div class="container">
      <div class="row">
      		<div class="widget stacked">	
				<div class="widget-header">
					<i class="icon-bookmark"></i>
					<h3>{{ 'SHORTCUTS' | i18n }}</h3>
				</div> <!-- /widget-header -->
				<div class="widget-content">
					<div class="shortcuts">
                        <a ng-click="vm.connect()" ng-show="!connected" class="shortcut">
                            <i class="shortcut-icon icon-refresh"></i>
                            <span class="shortcut-label">{{ 'CONNECT' | i18n }}</span>
                        </a>
                        <a ng-click="vm.connect()" ng-show="connected" class="shortcut">
                            <i class="shortcut-icon icon-refresh"></i>
                            <span class="shortcut-label">{{ 'DISCONNECT' | i18n }}</span>
                        </a>
					</div> <!-- /shortcuts -->	
				</div> <!-- /widget-content -->
			</div> <!-- /widget -->
		</div>
		<div class="row">
      		<div class="widget stacked widget-table action-table">
				<div class="widget-header">
					<i class="icon-th-list"></i>
					<h3>{{ 'INTERACTIVECONSOLE' | i18n }}</h3>
				</div> <!-- /widget-header -->
				<div class="widget-content">
                    <form class="form-inline">
                        <div class="row-fluid">
                            <div class="span4">
                                <div class="row-fluid">
                                    <div class="span12">
                                        <label class="control-label"><span class="label label-info">{{ 'FILTERINGCRITERIAS' | i18n }}</span></label>
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span3">
                                        <label class="control-label">{{ 'PLAYERNAMES' | i18n }}</label>
                                    </div>
                                    <div class="span6">
                                        <input type="text" id="filter_member_name" class="input-medium" placeholder="{{ 'PLAYERNAME' | i18n }}" ng-model="filter_name">
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span3">
                                        <label class="control-label">{{ 'SERVERS' | i18n }}</label>
                                    </div>
                                    <div class="span6">
                                        <input type="text" id="filter_member_name" class="input-medium" placeholder="{{ 'SERVERID' | i18n }}" ng-model="filter_server">
                                    </div>
                                </div>
                            </div>
                            <div class="span8">
                                <div class="row-fluid">
                                    <div class="span12">
                                        <label class="control-label"><span class="label">{{ 'LOADINGCRITERIAS' | i18n }}</span></label>
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span2">
                                        <input type="text" id="filters_player_name" class="input-medium" placeholder="{{ 'PLAYERNAME' | i18n }}" ng-model="filters.player_name">
                                    </div>
                                    <div class="span2 offset1">
                                        <input type="text" id="filters_player_guid" class="input-medium" placeholder="{{ 'PLAYERGUID' | i18n }}" ng-model="filters.guid">
                                    </div>
                                    <div class="span2 offset1">
                                        <input type="text" id="filters_last_datetime" class="input-medium" placeholder="JJ/MM/AAAA hh:mm:ss" ng-model="filters.last_datetime">
                                    </div>
                                    <div class="span2 offset1">
                                        <input type="text" id="filters_last_server" class="input-medium" placeholder="{{ 'SERVERID' | i18n }}" ng-model="filters.last_server">
                                    </div>
                                </div>
                                <div class="row-fluid">
                                    <div class="span2">
                                        <input type="text" id="filters_list_size" class="input-medium" placeholder="60" ng-model="filters.list_size">
                                    </div>
                                    <div class="span2 offset1">
                                        <input type="text" id="filters_last_ip" class="input-medium" placeholder="aaa.bbb.ccc.ddd" ng-model="filters.last_ip">
                                    </div>
                                    <div class="span2 offset1">
                                        <input type="text" id="filters_is_banned" class="input-medium" placeholder="{{ 'FILTERBANNED' | i18n }}" ng-model="filters.is_banned">
                                    </div>
                                   <div class="span2 offset1">
                                        <a class="btn btn-inverse" ng-click="filters = {}">
                                            <span class="icon-filter"> {{ 'RESETFILTERS' | i18n }}</span>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                    <form name="playersListForm">
                        <table class="table table-striped table-bordered">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>{{ 'NAME' | i18n }}</th>
                                    <th>{{ 'GUID' | i18n }}</th>
                                    <th>{{ 'GAMEID' | i18n }}</th>
                                    <th>{{ 'SERVER' | i18n }}</th>
                                    <th>{{ 'CONNECTED' | i18n }}</th>
                                    <th>{{ 'IP' | i18n }}</th>
                                    <th></th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr ng-repeat="player in players" ng-class="{error:player.is_banned}" ng-show="(filter_name == null || filter_name.length <= 0 || player.player_name.toLowerCase().indexOf(filter_name.toLowerCase()) >= 0) && (filter_server == null || filter_server.length <= 0 || player.last_server == filter_server)">
                                    <td>{{ player.player_id }}</td>
                                    <td>{{ player.player_name }} <span style="white-space: nowrap;">({{ player.connection_count }}&nbsp;/&nbsp;{{ player.bans.length }})</span></td>
                                    <td>{{ player.guid }}</td>
                                    <td>{{ player.gameid }}</td>
                                    <td>{{ player.last_server }}</td>
                                    <td>{{ player.last_datetime }}</td>
                                    <td>{{ player.last_ip }}</td>
                                    <td>
                                        <div ng-show="!player.is_banned && user.role >= 2">
                                            <input type="text" ng-model="player.ban.reason" placeholder="{{ 'BANREASON' | i18n }}" />
                                            <a class="btn btn-danger" ng-show="!playersListForm.$pristine" ng-click="vm.banPlayers()">
                                                <span class="icon-ban-circle"></span>
                                            </a>
                                        </div>
                                        <div ng-show="player.is_banned && user.role >= 2">
                                            <div style="float:left;">
                                                <div ng-repeat ="ban in player.bans">
                                                    <span class="uneditable-input" ng-bind="ban.reason"></span>
                                                    <span class="label label-info" ng-bind="ban.user.login"></span>
                                                </div>
                                            </div>
                                            <div>
                                                <a class="btn btn-success" ng-click="vm.liftPlayerBan(player)">
                                                    <span class="icon-ok"> {{ 'LIFTBAN' | i18n }}</span>
                                                </a>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </form>
				</div> <!-- /widget-content -->
			</div>
		</div>
	</div>
</div>
